¿Que hace lo siguiente:?


In [1]:
x = 0.1


Out[1]:
0.1

Guarda en x el valor ya redondeado (convertido a un flotante cercano), segun el modo actual de redondeo.


In [4]:
get_rounding(Float64)


Out[4]:
Base.Rounding.RoundingMode{:Nearest}()

In [5]:
bits(x)


Out[5]:
"0011111110111001100110011001100110011001100110011001100110011010"

In [6]:
set_rounding(Float64, RoundDown)


Out[6]:
0

In [7]:
0.1


Out[7]:
0.09999999999999999

In [8]:
float("0.1")


Out[8]:
0.09999999999999999

In [9]:
set_rounding(Float64, RoundNearest)


Out[9]:
0

In [10]:
0.1


Out[10]:
0.1

In [11]:
big(0.1)


Out[11]:
1.000000000000000055511151231257827021181583404541015625e-01 with 256 bits of precision

In [13]:
bits(0.1*1.25)


Out[13]:
"0011111111000000000000000000000000000000000000000000000000000000"

In [14]:
set_rounding(Float64)
0.1*1.25


Out[14]:
0.12499999999999999

In [15]:
bits(ans)


Out[15]:
"0011111110111111111111111111111111111111111111111111111111111111"

In [16]:
versioninfo()


Julia Version 0.4.0-dev+3472
Commit 8c87a32* (2015-02-20 05:10 UTC)
Platform Info:
  System: Darwin (x86_64-apple-darwin13.4.0)
  CPU: Intel(R) Core(TM) i7-4750HQ CPU @ 2.00GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT NO_AFFINITY NEHALEM)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

In [ ]: